﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using cbelo.Controllers;
using System.Web.Security;

namespace cbelo.Models
{
    public class panoRepositorio
    {
        cbeloEntities connection = new cbeloEntities();

        public IQueryable<panoprato> Select()
        {
            var result = from p in connection.panoprato
                         orderby p.idpanoprato
                         select p;
            return result;
        }

        public IQueryable<panoproduct> SelectProduct()
        {
            var result = from p in connection.panoproduct
                         orderby p.idpanoproduct
                         select p;
            return result;
        }

        public IQueryable<panoproduct> SelectGroup(int id)
        {
            var result = from p in SelectProduct()
                         where p.idpano == id
                         select p;
            return result;
        }

        public String GetGroupName(int id)
        {
            var result = from p in Select()
                         where p.idpanoprato == id
                         select p;

            if (result.Count() == 0)
                return "";

            return result.First().nomepano;
        }

        /*
        public void Add(mdf mdfdata)
        {
            connection.AddTomdf(mdfdata);
        }


        public void Delete(mdf mdfdata)
        {
            connection.DeleteObject(mdfdata);
        }


        public void Save()
        {
            connection.SaveChanges();
        }
        */

    }
}